#include"ros/ros.h"
#include"plumbing_server_client/AddInts.h"








/* 
实现参数的动态提交:
    1.格式 rosrun xxx xxx 12 43
    2.


*/
int main(int argc, char *argv[])
{
    
    if (argc !=3){
        ROS_INFO("提交参数不对！");
        return -1;
    }

    ros::init(argc,argv,"ren");

    ros::NodeHandle nh;

    ros::ServiceClient client= nh.serviceClient<plumbing_server_client::AddInts>("addInts");

    plumbing_server_client::AddInts ai;

    ai.request.num1 = atoi(argv[1]);
    ai.request.num2 = atoi(argv[2]);

   // client.waitForExistence();
    ros::service::waitForService("addInts");
    bool flag = client.call(ai);
    if (flag){
        ROS_INFO("response success!");
        ROS_INFO("result is %d",ai.response.sum);
    }
    else{
        ROS_INFO("response fail!");
    }


    return 0;
}
 